package com.dys.designpattern.simplefactory.distributeprizestosimplefactories.factory;

import com.dys.designpattern.simplefactory.distributeprizestosimplefactories.service.IFreeGoods;
import com.dys.designpattern.simplefactory.distributeprizestosimplefactories.service.impl.DiscountFreeGoods;
import com.dys.designpattern.simplefactory.distributeprizestosimplefactories.service.impl.SmallGiftFreeGoods;
import com.dys.designpattern.simplefactory.distributeprizestosimplefactories.service.impl.YouKuMemberFreeGoods;

/**
 * @Author: 疾风
 * @ClassName: FreeGoodsFactory
 * @Description: 具体工厂：生成免费的商品
 * @CreateDate: 2024/05/13
 * @Version: v1.0.0
 */
public class FreeGoodsFactory {

    public static IFreeGoods getInstance(Integer awardType) {
        IFreeGoods iFreeGoods = null;
        if (awardType == 1) { // 1.打折券
            iFreeGoods = new DiscountFreeGoods();
        } else if (awardType == 2) { // 2.优酷会员
            iFreeGoods = new YouKuMemberFreeGoods();
        } else if (awardType == 3) {
            iFreeGoods = new SmallGiftFreeGoods();
        } else {
            System.out.println("没有优惠");
        }
        return iFreeGoods;
    }
}
